var mongoose = require('../../cfg/dbconfig.js')
var homeMenuLinkSchema = new mongoose.Schema({
    title:String,
    icon:String,
    url:String,
    status:Boolean,
    sq:Number,
    roles:String,
}, { collection: 'homemenulink' })

//根据条件查找记录并返回（全部/指定）字段
//myFindByQuery({"_id":'1231231231232'})
//myFindByQuery({"_id":'1231231231232'},'name gender')  myFindByQuery({"_id":'1231231231232'},'-name -gender')  
homeMenuLinkSchema.statics.myFindByQuery=async function(query,fields){
    if(fields)
    {
        return await this.find(query,fields).exec()
    }
    return await this.find(query).exec()
}

module.exports = mongoose.model('homemenulink', homeMenuLinkSchema)